package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppStandardRelease;
import com.ep.modules.app.service.AppStandardReleaseService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/standard_release")
public class AppStandardReleaseController {
    @Autowired
    private AppStandardReleaseService appStandardReleaseService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appStandardReleaseService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppStandardRelease appstandardrelease = appStandardReleaseService.getById(id);
        return R.ok().put("appstandardrelease", appstandardrelease);
    }

    @SysLog("保存AppStandardRelease")
    @PostMapping("/save")
    public R save(@RequestBody AppStandardRelease appstandardrelease) {
        ValidatorUtils.validateEntity(appstandardrelease);
        appStandardReleaseService.save(appstandardrelease);
        return R.ok();
    }

    @SysLog("修改AppStandardRelease")
    @PostMapping("/update")
    public R update(@RequestBody AppStandardRelease appstandardrelease) {
        ValidatorUtils.validateEntity(appstandardrelease);
        appStandardReleaseService.update(appstandardrelease);
        return R.ok();
    }

    @SysLog("删除AppStandardRelease")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appStandardReleaseService.deleteBatch(ids);
        return R.ok();
    }
}